package org.lanqiao.tjut.control;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lanqiao.tjut.bean.ScoreBean;
import org.lanqiao.tjut.service.ServiceFactory;

public class ScoreStuClass extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		// 接收客户端数据请求时进行编码设置，防止中文乱码
		// request.setCharacterEncoding("UTF-8");
		// 获取学生名
		String stuname = request.getParameter("uid");
		//获取课程名
		String classname = request.getParameter("sid");
		// 根据学生名在成绩表中获取学生的信息（默认为null）
		ScoreBean stuBean = ServiceFactory.getSelectClassManagerServiceInstance().getStuInfoByStuName(stuname,classname);
		// 将获取结果放入request缓存中
		request.setAttribute("stuBean", stuBean);
		// 跳转到修改页面
		request.getRequestDispatcher("SelectClass/ScoreStuClass.jsp").forward(request, response);

	}

	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		super.destroy();
	}

	@Override
	public void init() throws ServletException {
		// TODO Auto-generated method stub
		super.init();
	}

}
